<template>
  <view class="report_eightItem" @click="handleClick">
    <view class="item_icon" :class="item.physicalName"></view>
    <view class="text">{{ itemName }}{{ showValue ? `:${item.physicalValue}${unit}` : '' }}</view>
  </view>
</template>

<script>
import eightPhysical from '@/util/eightPhysical'
export default {
  name: 'report_eightItem',
  // components: {},
  props: {
    showValue: {
      type: Boolean,
      default: false
    },
    item: Object
  },
  data() {
    const eightObj = eightPhysical[this.item.physicalName]
    const itemName = eightObj.text
    const unit = eightObj.unit
    return {
      itemName,
      unit
    }
  },
  methods: {
    handleClick() {
      this.$emit('EIGHTITEM_CLICK', this.item)
    }
  }
}
</script>

<style lang="scss">
.report_eightItem {
  position: relative;
  width: 330rpx;
  height: 230rpx;
  background-color: #ffffd7;
  border-radius: 40rpx;

  @include boxWithDashed(40rpx, #0052e1, 10rpx);

  .item_icon {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-100rpx);
    width: 243rpx;
    height: 186rpx;
    background-repeat: no-repeat;
    background-size: contain;

    &.height {
      background-image: url('#{$BASEURL}/rd_height.png');
    }
    &.weight {
      background-image: url('#{$BASEURL}/rd_weight.png');
    }
    &.standingJump {
      background-image: url('#{$BASEURL}/rd_standingJump.png');
    }
    &.tennisThrow {
      background-image: url('#{$BASEURL}/rd_tennisThrow.png');
    }
    &.balanceBeam {
      background-image: url('#{$BASEURL}/rd_balanceBeam.png');
    }
    &.sitAndReach {
      background-image: url('#{$BASEURL}/rd_sitAndReach.png');
    }
    &.tenMeterTurn {
      background-image: url('#{$BASEURL}/rd_tenMeterTurn.png');
    }
    &.doubleJump {
      background-image: url('#{$BASEURL}/rd_doubleJump.png');
    }
  }

  .text {
    position: absolute;
    bottom: 30rpx;
    left: 50%;
    transform: translateX(-50%);
    width: 280rpx;
    height: 50rpx;
    line-height: 48rpx;
    background-color: #ffff00;
    box-shadow: 0px 10rpx 20rpx 0px rgba(0, 0, 0, 0.2);
    border-radius: 25rpx;
    text-align: center;
    font-size: 30rpx;

    @include text-ellipsis();
  }
}
</style>
